package com.yanqu.road.server.cmd.activity.relation.cross;

import com.yanqu.road.pb.cookboyactivity.CookBoyActivityProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.player.GamePlayerMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CROSS_RELATION_ACTIVITY_CONDITION_NOTIFY, desc = "从其他服返回过来的")
public class RelationActivityMemberConditionDataNotifyCmd extends AbstractCommand {

	@Override
	public boolean parseData(YanQuMessage packet) throws Exception {
		CookBoyActivityProto.CrossCookBoyConditionUnionMemberDataRespMsg reqMsg = CookBoyActivityProto.CrossCookBoyConditionUnionMemberDataRespMsg.parseFrom(packet.getBytes());
		CookBoyActivityProto.CrossCookBoyConditionUnionMemberDataMsg dataMsg = reqMsg.getDataMsg();
		long userId = dataMsg.getUserId();
		GamePlayer player = GamePlayerMgr.getOnlinePlayer(userId);
		if(null != player){
			CookBoyActivityProto.CookBoyActivityConditionUnionMemberDataRespMsg.Builder msg = CookBoyActivityProto.CookBoyActivityConditionUnionMemberDataRespMsg.newBuilder();
			msg.setRet(dataMsg.getRet());
			if(0 == dataMsg.getRet()){
				msg.setDataList(dataMsg.getDataList());
			}
			player.sendPacket(Protocol.U_COOK_BOY_ACTIVITY_MEMBER_CONDITION_DATA, msg);
		}
		return true;
	}

	@Override
	public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

	}

	@Override
	public void sendData(GamePlayer player) {

	}

}